package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.util.RequestUtil;

import lombok.extern.slf4j.Slf4j;

/**
 *
 * @author changwei
 * @date 2019年10月21日
 */
@Slf4j
@Controller
@RequestMapping("/html")
public class HtmlController {

	@RequestMapping("/index")
	public String index() {
		return "index";
	}
	
	@RequestMapping("/websocket")
	public String websocket() {
		log.debug("***********  *************, threadId :{}", RequestUtil.getSession().getId() );
		log.debug("*********** websocket method excute *************, threadId :{}", Thread.currentThread().getId());
		RequestUtil.getSession().setAttribute("aaa", "111");
		return "websocket";
	}
	
	@ResponseBody
	@RequestMapping(value="/restStr", method= {RequestMethod.GET,RequestMethod.POST})
	public String restStr(String str) {
		return str;
	}
}
